Xbasic

FORM.QUERY_RUN Function

Syntax

.Query_Run()

Description

The .QUERY_RUN() method runs the query specified in the Query by Form window.

Example

This script loads the customer form, puts it into Query by Form mode, enters a search restriction in the State field, runs the query and then shows the form.

Form.load("Customer")
customer.query_by_form()
customer:state.value = "MA"
customer.query_run()
customer.show()

This script does the same query as the above script, but instead, sets the form's base filter (a logical expression ). This filter cannot be turned off by pressing the Show All button. (The script assumes that the Customer form is based on the Customer table.)

Form.load("Customer")
customer:tables:customer.filter_expression = "state = 'MA'"
customer:tables:customer.query()
:customer.show()

This script is similar to the above script in that it runs a query for the Customer form. Unlike the above script, the query does not set the form's base filter. Therefore, pressing the Show All button after the query has run will show all records in the form.

Form.load("customer")
query.filter = "state = 'MA'"
:customer:tables:customer.query_create()
:customer.fetch_first()
:customer.resynch()
:customer.show()
:customer.activate()

Limitations

Desktop applications only.

See Also